
package com.azt.front.action.company.shop;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.azt.api.dto.company.CompanyProviderExt;
import com.azt.api.dto.company.CompanySearchParam;
import com.azt.api.dto.item.ProductExt;
import com.azt.api.dto.item.SkuModel;
import com.azt.api.dto.shop.ProSearchParam;
import com.azt.api.pojo.*;
import com.azt.api.service.CompanyService;
import com.azt.api.service.CompanySignService;
import com.azt.api.service.ProductService;
import com.azt.front.utils.ContextUtil;
import com.azt.model.AjaxJson;
import com.azt.model.page.TPagination;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 供应商检索
 * Created by 张栋 on 2017/2/2018:24
 */
@Controller
@RequestMapping("/provider")
public class ProviderAction {

    @Autowired
    private CompanyService companyService;

    @RequestMapping("")
    public String providerSearch(HttpServletRequest request, ModelMap model, CompanySearchParam param) {
        param.setPageSize(5);
        model.put("param", param);
        return "company/provider_search";
    }

    @RequestMapping("provider_search")
    @ResponseBody
    public TPagination providerSearch(@RequestBody CompanySearchParam param) {
        param.setPageSize(5);
        AjaxJson j = new AjaxJson();
        TPagination<CompanyProviderExt> pagination = companyService.getSearchProvider(param);
        return pagination;
    }
}
